home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2001-04-17 | 79.7 KB | 1,387 lines
TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) NNNNAAAAMMMMEEEE termio, termios - general terminal interfaces SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS ####iiiinnnncccclllluuuuddddeeee <<<<tttteeeerrrrmmmmiiiioooossss....hhhh>>>> iiiiooooccccttttllll ((((iiiinnnntttt ffffiiiillllddddeeeessss,,,, iiiinnnntttt rrrreeeeqqqquuuueeeesssstttt,,,, ssssttttrrrruuuucccctttt tttteeeerrrrmmmmiiiioooossss ****aaaarrrrgggg))));;;; iiiiooooccccttttllll ((((iiiinnnntttt ffffiiiillllddddeeeessss,,,, iiiinnnntttt rrrreeeeqqqquuuueeeesssstttt,,,, iiiinnnntttt aaaarrrrgggg))));;;; ####iiiinnnncccclllluuuuddddeeee <<<<tttteeeerrrrmmmmiiiioooo....hhhh>>>> iiiiooooccccttttllll ((((iiiinnnntttt ffffiiiillllddddeeeessss,,,, iiiinnnntttt rrrreeeeqqqquuuueeeesssstttt,,,, ssssttttrrrruuuucccctttt tttteeeerrrrmmmmiiiioooo ****aaaarrrrgggg))));;;; DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN All of the asynchronous communications ports use the same general interface, no matter what hardware is involved. The user interface to this functionality is via the _i_o_c_t_l calls described below, or the POSIX _t_e_r_m_i_o_s interface described in _t_e_r_m_i_o_s(3t). The remainder of this section discusses the common features of the terminal subsystem which are relevant to both of these interfaces. RRRReeeecccceeeennnntttt cccchhhhaaaannnnggggeeeessss The tttteeeerrrrmmmmiiiioooo and tttteeeerrrrmmmmiiiioooossss structures have been changed to support bit rates of greater than 38400 bps. Each of these structures has two new members _c__o_s_p_e_e_d and _c__i_s_p_e_e_d which store the output and input bit rates, respectively. They replace the CCCCBBBBAAAAUUUUDDDD and CCCCIIIIBBBBAAAAUUUUDDDD fields of the _c__c_f_l_a_g member. CCCCBBBBAAAAUUUUDDDD and CCCCIIIIBBBBAAAAUUUUDDDD should no longer be modified or examined by applications. (Because no current SGI hardware supports setting input and output to different rates, _c__i_s_p_e_e_d is currently unsupported. Applications should either not modify it, or should set it to the same value as _c__o_s_p_e_e_d.) Unlike CCCCBBBBAAAAUUUUDDDD and CCCCIIIIBBBBAAAAUUUUDDDD, _c__o_s_p_e_e_d and _c__i_s_p_e_e_d encode bit rates as plain integers. To set a bit rate of 38400 bits per second, an application would set _c__o_s_p_e_e_d to the integer value 38400. For convenience, macros such as BBBB33338888444400000000 have been provided for several common bit rates. Note that the capabilities of various serial port hardware differ; many still do not support rates greater than 38400 bps (see _s_e_r_i_a_l(_7) for more information on different serial port types.) Applications therefore need to check the return values of library calls that attempt to set bit rates (such as iiiiooooccccttttllll described here) , because the calls may now fail in more situations than before. CCCCoooonnnnttttrrrroooolllllllliiiinnnngggg TTTTeeeerrrrmmmmiiiinnnnaaaallll When a terminal file is opened, it normally causes the process to wait until a connection is established. In practice, users' programs seldom open terminal files; they are opened by the system and become a user's standard input, output and error files. The very first terminal file PPPPaaaaggggeeee 1111 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) opened by the session leader which is not already associated with a session becomes the controlling terminal for the session. If a process does not wish to acquire the terminal as a controlling terminal (as is the case with many daemons that open ////ddddeeeevvvv////ccccoooonnnnssssoooolllleeee), the process should add the OOOO____NNNNOOOOCCCCTTTTTTTTYYYY flag into the second argument bitmask to _o_p_e_n(2). The controlling terminal is inherited by the child process during a _f_o_r_k(2). A process can break this association by changing its session using _s_e_t_s_i_d(2). (Currently, this also happens if a process issues a System V _s_e_t_p_g_r_p() or _B_S_D_s_e_t_p_g_r_p(mypid, 0). This provides backward compatibility with SVR3 and BSD4.3). When a session leader that has a controlling terminal exits, the SSSSIIIIGGGGHHHHUUUUPPPP signal will be sent to each process in the foreground process group of the controlling terminal and the controlling terminal will be disassociated from the current session. This allows the terminal to be acquired by a new session leader. Subsequent access to the terminal by other processes in the earlier session will fail, returning the error code EEEEIIIIOOOO. SSSSeeeessssssssiiiioooonnnn MMMMaaaannnnaaaaggggeeeemmmmeeeennnntttt ((((JJJJoooobbbb CCCCoooonnnnttttrrrroooollll)))) A controlling terminal will designate one of the process groups in the session associated with it as the ffffoooorrrreeeeggggrrrroooouuuunnnndddd process group. All other process groups in the session are designated as bbbbaaaacccckkkkggggrrrroooouuuunnnndddd process groups. The foreground process group plays a special role in handling signal-generating input characters, as discussed below. By default, when a controlling terminal is allocated, the controlling process's process group is assigned as the foreground process group. Background process groups in the controlling process's session are subject to a job control line discipline when they attempt to access their controlling terminal. Typically, they will be sent signals that will cause them to stop, unless they have made other arrangements. An exception is made for members of orphaned process groups. When a member of an orphaned process group attempts to access its controlling terminal, an error is returned since there is no process to continue it should it stop. If a member of a background process group attempts to _r_e_a_d its controlling terminal, its process group will be sent a SSSSIIIIGGGGTTTTTTTTIIIINNNN signal, which will normally cause the members of that process group to stop. If, however, the process is ignoring or holding SSSSIIIIGGGGTTTTTTTTIIIINNNN, or is a member of an orphaned process group, the _r_e_a_d will fail with eeeerrrrrrrrnnnnoooo set to EEEEIIIIOOOO, and no signal will be sent. If a member of a background process group attempts to _w_r_i_t_e to its controlling terminal and the TTTTOOOOSSSSTTTTOOOOPPPP bit is set in the _c__l_f_l_a_g field (see below), its process group will be sent a SSSSIIIIGGGGTTTTTTTTOOOOUUUU signal, which will normally cause the members of that process group to stop. If, however, the process is ignoring or holding SSSSIIIIGGGGTTTTTTTTOOOOUUUU, the _w_r_i_t_e will succeed. If PPPPaaaaggggeeee 2222 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) the process is not ignoring or holding SSSSIIIIGGGGTTTTTTTTOOOOUUUU and is a member of an orphaned process group, the _w_r_i_t_e will fail with eeeerrrrrrrrnnnnoooo set to EEEEIIIIOOOO, and no signal will be sent. If a member of a background process group attempts to invoke an _i_o_c_t_l() on its controlling terminal, and that _i_o_c_t_l() will modify terminal parameters (e.g. TTTTCCCCSSSSEEEETTTTAAAA,,,, TTTTCCCCSSSSEEEETTTTAAAAWWWW,,,, TTTTCCCCSSSSEEEETTTTAAAAFFFF, or TTTTIIIIOOOOCCCCSSSSPPPPGGGGRRRRPPPP), and the TTTTOOOOSSSSTTTTOOOOPPPP bit is set in the _c__l_f_l_a_g field, its process group will be sent a SSSSIIIIGGGGTTTTTTTTOOOOUUUU signal, which will normally cause the members of that process group to stop. If, however, the process is ignoring or holding SSSSIIIIGGGGTTTTTTTTOOOOUUUU, the _i_o_c_t_l() will succeed. If the process is not ignoring or holding SSSSIIIIGGGGTTTTTTTTOOOOUUUU and is a member of an orphaned process group, the _i_o_c_t_l() will fail with eeeerrrrrrrrnnnnoooo set to EEEEIIIIOOOO, and no signal will be sent. IIIInnnnppppuuuutttt PPPPrrrroooocccceeeessssssssiiiinnnngggg aaaannnndddd RRRReeeeaaaaddddiiiinnnngggg CCCChhhhaaaarrrraaaacccctttteeeerrrrssss A terminal associated with one of these files ordinarily operates in full-duplex mode. Characters may be typed at any time, even while output is occurring, and are only lost when the system's character input buffers become completely full (which is rare) or when the user has accumulated the maximum allowed number of input characters that have not yet been read by some program. Currently, this limit is {MAX_CANON} characters (see _p_a_t_h_c_o_n_f(_2)). When the input limit is reached, the buffer is flushed and all the saved characters are thrown away without notice. CCCCaaaannnnoooonnnniiiiccccaaaallll MMMMooooddddeeee IIIInnnnppppuuuutttt PPPPrrrroooocccceeeessssssssiiiinnnngggg Normally, terminal input is processed in units of lines. A line is delimited by a new-line (ASCII LLLLFFFF)))) character, an end-of-file (ASCII EEEEOOOOTTTT)))) character, or an end-of-line character. This means that a program attempting to _r_e_a_d will be suspended until an entire line has been typed. Also, no matter how many characters are requested in the _r_e_a_d call, at most one line will be returned. It is not, however, necessary to _r_e_a_d a whole line at once; any number of characters may be requested in a _r_e_a_d, even one, without losing information. During input, erase and kill processing is normally done. The EEEERRRRAAAASSSSEEEE character (Control-H) erases the last character typed. The WWWWEEEERRRRAAAASSSSEEEE character (Control-W) erases the last ``word'' typed in the current input line (but not any preceding spaces or tabs). A ``word'' is defined as a sequence of non-blank characters, with tabs counted as blanks. Neither EEEERRRRAAAASSSSEEEE or WWWWEEEERRRRAAAASSSSEEEE will erase beyond the beginning of the line. The KKKKIIIILLLLLLLL character (Control-U) kills (deletes) the entire input line, and optionally outputs a new-line character. All these characters operate on a key-stroke basis, independently of any backspacing or tabbing that may have been done. The RRRREEEEPPPPRRRRIIIINNNNTTTT character (Control-R) prints a newline followed by all unread characters. The characters are reprinted as if they were being echoed; consequently if the EEEECCCCHHHHOOOO flag is not set (see below), they are not printed. The EEEERRRRAAAASSSSEEEE, WWWWEEEERRRRAAAASSSSEEEE, KKKKIIIILLLLLLLL and RRRREEEEPPPPRRRRIIIINNNNTTTT characters may be changed. NNNNoooonnnn----ccccaaaannnnoooonnnniiiiccccaaaallll MMMMooooddddeeee IIIInnnnppppuuuutttt PPPPrrrroooocccceeeessssssssiiiinnnngggg In non-canonical mode input processing, input characters are not assembled into lines, and erase and kill processing does not occur. The PPPPaaaaggggeeee 3333 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) _MMMM_IIII_NNNN and _TTTT_IIII_MMMM_EEEE values are used to determine how to process the characters received. _MMMM_IIII_NNNN represents the minimum number of characters that should be received when the read is satisfied (i.e., when the characters are returned to the user). _TTTT_IIII_MMMM_EEEE is a timer of 0.10-second granularity that is used to timeout bursty and short-term data transmissions. The four possible values for _MMMM_IIII_NNNN and _TTTT_IIII_MMMM_EEEE and their interactions are described below. Case A: _MMMM_IIII_NNNN > 0, _TTTT_IIII_MMMM_EEEE > 0 In this case, _TTTT_IIII_MMMM_EEEE serves as an intercharacter timer and is activated after the first character is received. Since it is an intercharacter timer, it is reset after a character is received. The interaction between _MMMM_IIII_NNNN and _TTTT_IIII_MMMM_EEEE is as follows: as soon as one character is received, the intercharacter timer is started. If _MMMM_IIII_NNNN characters are received before the intercharacter timer expires (note that the timer is reset upon receipt of each character), the read is satisfied. If the timer expires before _MMMM_IIII_NNNN characters are received, the characters received to that point are returned to the user. Note that if _TTTT_IIII_MMMM_EEEE expires, at least one character will be returned because the timer would not have been enabled unless a character was received. In this case (_MMMM_IIII_NNNN > 0, _TTTT_IIII_MMMM_EEEE > 0), the read sleeps until the _MMMM_IIII_NNNN and _TTTT_IIII_MMMM_EEEE mechanisms are activated by the receipt of the first character. If the number of characters read is less than the number of characters available, the timer is not reactivated and the subsequent read is satisfied immediately. Case B: _MMMM_IIII_NNNN > 0, _TTTT_IIII_MMMM_EEEE = 0 In this case, since the value of _TTTT_IIII_MMMM_EEEE is zero, the timer plays no role and only _MMMM_IIII_NNNN is significant. A pending read is not satisfied until _MMMM_IIII_NNNN characters are received (the pending read sleeps until _MMMM_IIII_NNNN characters are received). A program that uses this case to read record based terminal I/O may block indefinitely in the read operation. Case C: _MMMM_IIII_NNNN = 0, _TTTT_IIII_MMMM_EEEE > 0 In this case, since _MMMM_IIII_NNNN = 0, _TTTT_IIII_MMMM_EEEE no longer represents an intercharacter timer: it now serves as a read timer that is activated as soon as a read is done. A read is satisfied as soon as a single character is received or the read timer expires. Note that, in this case, if the timer expires, no character is returned. If the timer does not expire, the only way the read can be satisfied is if a character is received. In this case, the read will not block indefinitely waiting for a character; if no character is received within _TTTT_IIII_MMMM_EEEE*.10 seconds after the read is initiated, the read returns with zero characters. Case D: _MMMM_IIII_NNNN = 0, _TTTT_IIII_MMMM_EEEE = 0 In this case, return is immediate. The minimum of either the number of characters requested or the number of characters currently available is returned without waiting for more characters to be input. PPPPaaaaggggeeee 4444 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) WWWWrrrriiiittttiiiinnnngggg CCCChhhhaaaarrrraaaacccctttteeeerrrrssss When one or more characters are written, they are transmitted to the terminal as soon as previously-written characters have finished typing. Input characters are echoed by putting them in the output queue as they arrive. If a process produces characters more rapidly than they can be typed, it will be suspended when its output queue exceeds some limit. When the queue has drained down to some threshold, the program is resumed. SSSSppppeeeecccciiiiaaaallll CCCChhhhaaaarrrraaaacccctttteeeerrrrssss Certain characters have special functions on input. These functions and their default character values are summarized as follows: IIIINNNNTTTTRRRR (Typically, rubout or ASCII DDDDEEEELLLL)))) generates an _i_n_t_e_r_r_u_p_t signal SSSSIIIIGGGGIIIINNNNTTTT which is sent to all foreground processes with the associated controlling terminal. Normally, each such process is forced to terminate, but arrangements may be made either to ignore the signal or to receive a trap to an agreed-upon location; see _s_i_g_n_a_l(2). QQQQUUUUIIIITTTT (Typically, control-\ or ASCII FFFFSSSS)))) generates a _q_u_i_t signal SSSSIIIIGGGGQQQQUUUUIIIITTTT. Its treatment is identical to the interrupt signal except that, unless a receiving process has made other arrangements, it will not only be terminated, but a core image file (called ccccoooorrrreeee) will be created in the current working directory. EEEERRRRAAAASSSSEEEE (Typically, control-H or backspace) erases the preceding character. It will not erase beyond the start of a line, as delimited by a NNNNLLLL,,,, EEEEOOOOFFFF,,,, EEEEOOOOLLLL,,,, or EEEEOOOOLLLL2222 character. KKKKIIIILLLLLLLL (Typically, control-U) deletes the entire line, as delimited by a NNNNLLLL,,,, EEEEOOOOFFFF,,,, EEEEOOOOLLLL,,,, or EEEEOOOOLLLL2222 character. EEEEOOOOFFFF (Typically, control-D or ASCII EEEEOOOOTTTT)))) may be used to generate an end-of-file from a terminal. When received, all the characters waiting to be read are immediately passed to the program, without waiting for a new-line, and the EEEEOOOOFFFF is discarded. Thus, if there are no characters waiting, which is to say the EEEEOOOOFFFF occurred at the beginning of a line, zero characters will be passed back, which is the standard end- of-file indication. NNNNLLLL (ASCII LLLLFFFF)))) is the normal line delimiter. It can not be changed or escaped. EEEEOOOOLLLL (Typically, ASCII NNNNUUUULLLL)))) is an additional line delimiter, like NNNNLLLL.... It is not normally used. EEEEOOOOLLLL2222 is another additional line delimiter. PPPPaaaaggggeeee 5555 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) SSSSTTTTOOOOPPPP (Typically, control-S or ASCII DDDDCCCC3333)))) can be used to temporarily suspend output. It is useful with CCCCRRRRTTTT terminals to prevent output from disappearing before it can be read. While output is suspended, SSSSTTTTOOOOPPPP characters are ignored and not read. SSSSTTTTAAAARRRRTTTT (Typically, control-Q or ASCII DDDDCCCC1111)))) is used to resume output which has been suspended by a SSSSTTTTOOOOPPPP character. While output is not suspended, SSSSTTTTAAAARRRRTTTT characters are ignored and not read. The SSSSTTTTAAAARRRRTTTT////SSSSTTTTOOOOPPPP characters can not be changed or escaped in LLLLDDDDIIIISSSSCCCC0000 (see ``Termio Structure'' below). The following characters have special functions on input when the POSIX _t_e_r_m_i_o_s interface is used or when the System V _t_e_r_m_i_o interface is used and the line discipline is set to the default of LLLLDDDDIIIISSSSCCCC1111 (see ``Termio Structure'' below). These functions and their default character values are summarized as follows: SSSSUUUUSSSSPPPP (Control-Z or ASCII SSSSUUUUBBBB)))) generates a SSSSIIIIGGGGTTTTSSSSTTTTPPPP signal which stops all processes in the foreground process group for that terminal. DDDDSSSSUUUUSSSSPPPP (Control-Y or ASCII EEEEMMMM) generates a SSSSIIIIGGGGTTTTSSSSTTTTPPPP signal as SSSSUUUUSSSSPPPP does, but the signal is sent when a process in the foreground process group attempts to read the DDDDSSSSUUUUSSSSPPPP character, rather than when it is typed. LLLLNNNNEEEEXXXXTTTT (Control-V or ASCII SSSSYYYYNNNN) causes the next character input to treated literally. WWWWEEEERRRRAAAASSSSEEEE (Control-W or ASCII EEEETTTTBBBB) erases the preceding white space- delimited word. It will not erase beyond the start of a line, as delimited by a NNNNLLLL,,,, EEEEOOOOFFFF,,,, EEEEOOOOLLLL,,,, or EEEEOOOOLLLL2222 character. RRRREEEEPPPPRRRRIIIINNNNTTTT (Control-R or ASCII DDDDCCCC2222) reprints all characters, preceded by a newline, that have not been read. FFFFLLLLUUUUSSSSHHHH (Control-O or ASCII SSSSIIII) when typed during output causes all subsequent output to be discarded. Typing any character re- enables output. This character is also known by the POSIX name DDDDIIIISSSSCCCCAAAARRRRDDDD The character values for IIIINNNNTTTTRRRR,,,, QQQQUUUUIIIITTTT,,,, EEEERRRRAAAASSSSEEEE,,,, WWWWEEEERRRRAAAASSSSEEEE,,,, KKKKIIIILLLLLLLL,,,, RRRREEEEPPPPRRRRIIIINNNNTTTT,,,, EEEEOOOOFFFF,,,, EEEEOOOOLLLL,,,, EEEEOOOOLLLL2222,,,, SSSSUUUUSSSSPPPP,,,, DDDDSSSSUUUUSSSSPPPP,,,, SSSSTTTTOOOOPPPP,,,, SSSSTTTTAAAARRRRTTTT,,,, FFFFLLLLUUUUSSSSHHHH////DDDDIIIISSSSCCCCAAAARRRRDDDD,,,, and LLLLNNNNEEEEXXXXTTTT may be changed to suit individual tastes (see _s_t_t_y(1)). If the value of a special control character is CCCCNNNNUUUULLLL or ____PPPPOOOOSSSSIIIIXXXX____VVVVDDDDIIIISSSSAAAABBBBLLLLEEEE, the function of that special control character is disabled. The EEEERRRRAAAASSSSEEEE,,,, KKKKIIIILLLLLLLL,,,, and EEEEOOOOFFFF characters may be entered literally in LLLLDDDDIIIISSSSCCCC0000 (see ``Termio Structure'' below), by preceding them with the escape character (\\\\), in which case no special function is done and the escape character is not read. Any of the special characters may be entered literally in the _t_e_r_m_i_o_s interface or if the _t_e_r_m_i_o interface line discipline is set to LLLLDDDDIIIISSSSCCCC1111 (see ``Termio PPPPaaaaggggeeee 6666 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) Structure'' below), by preceding them with the LLLLNNNNEEEEXXXXTTTT character, in which case no special function is done and the LLLLNNNNEEEEXXXXTTTT character is not read. MMMMooooddddeeeemmmm DDDDiiiissssccccoooonnnnnnnneeeecccctttt When a modem disconnect is detected, and if CCCCLLLLOOOOCCCCAAAALLLL is not set in the line discipline mode (see the discussion of the _c__c_f_l_a_g field below), a SSSSIIIIGGGGHHHHUUUUPPPP signal is sent to the terminal's controlling process. Unless other arrangements have been made, this signal causes the process to terminate. If SSSSIIIIGGGGHHHHUUUUPPPP is ignored or caught, any subsequent read returns with an end-of-file indication until the terminal is closed. Thus, programs that read a terminal and test for end-of-file can terminate appropriately after a disconnect. Any subsequent write will return -1 and set eeeerrrrrrrrnnnnoooo to EEEEIIIIOOOO until the device is closed. If the controlling process is not in the foreground process group of the terminal, a SSSSIIIIGGGGTTTTSSSSTTTTPPPP is sent to the terminal's foreground process group. Unless other arrangements have been made, this signal causes the processes to stop. Processes in background process groups that attempt to access the controlling terminal after modem disconnect, while the terminal is still allocated to the session, will receive appropriate SSSSIIIIGGGGTTTTTTTTOOOOUUUU and SSSSIIIIGGGGTTTTTTTTIIIINNNN signals. Unless other arrangements have been made, this signal causes the processes to stop. The controlling terminal will remain in this state until it is reinitialized with a successful open by the controlling process, or deallocated by the controlling process. TTTTeeeerrrrmmmmiiiinnnnaaaallll PPPPaaaarrrraaaammmmeeeetttteeeerrrrssss The parameters that control the behavior of devices and modules providing the tttteeeerrrrmmmmiiiioooossss interface are specified by the tttteeeerrrrmmmmiiiioooossss structure defined by <<<<tttteeeerrrrmmmmiiiioooossss....hhhh>>>>. Several _iiii_oooo_cccc_tttt_llll(2) system calls that fetch or change these parameters use this structure, which contains the following members: struct termios { tcflag_t c_iflag; /* input modes */ tcflag_t c_oflag; /* output modes */ tcflag_t c_cflag; /* control modes */ tcflag_t c_lflag; /* local modes */ speed_t c_ospeed; /* output speed */ speed_t c_ispeed; /* input speed; not supported */ cc_t c_cc[NCCS]; /* control chars */ }; The special control characters are defined by the array _cccc______cccc_cccc. The symbolic name NNNNCCCCCCCCSSSS is the size of the control-character array and is also defined by <<<<tttteeeerrrrmmmmiiiioooossss....hhhh>>>>. All space in the array is reserved or used as described below. The relative positions, subscript names, and normal default values for each function are as follows: PPPPaaaaggggeeee 7777 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) 0 VINTR CINTR (DEL) 1 VQUIT CQUIT (Control-\) 2 VERASE CERASE (Control-H (Backspace)) 3 VKILL CKILL (Control-U) 4 VEOF CEOF (Control-D) 4 VMIN 5 VEOL CEOL (NUL) 5 VTIME 6 VEOL2 CEOL2 (NUL) 7 VSWTCH CNSWTCH (NUL) 8 VSTART CSTART (Control-Q) 9 VSTOP CSTOP (Control-S) 10 VSUSP CNSWTCH (NUL) 11 VDSUSP CNUL (NUL) 12 VREPRINT CRPRNT (Control-R) 13 VFLUSH CFLUSH (Control-O) 14 VWERASE CWERASE (Control-W) 15 VLNEXT CLNEXT (Control-V) IIIInnnnppppuuuutttt MMMMooooddddeeeessss The _c__i_f_l_a_g field describes the basic terminal input control. The values, functions, and symbolic names of the bits in the _c__i_f_l_a_g field are as follows: IGNBRK 0000001 Ignore break condition. BRKINT 0000002 Signal interrupt on break. IGNPAR 0000004 Ignore characters with parity errors. PARMRK 0000010 Mark parity errors. INPCK 0000020 Enable input parity check. ISTRIP 0000040 Strip character. INLCR 0000100 Map NL to CR on input. IGNCR 0000200 Ignore CR. ICRNL 0000400 Map CR to NL on input. IUCLC 0001000 Map upper-case to lower-case on input. IXON 0002000 Enable start/stop output control. IXANY 0004000 Enable any character to restart output. IXOFF 0010000 Enable start/stop input control. IMAXBEL 0020000 Echo BEL on input line too long. IIIIGGGGNNNNBBBBRRRRKKKK If IIIIGGGGNNNNBBBBRRRRKKKK is set, a break condition (a character framing error with data all zeros) detected on input is ignored, that is, not put on the input queue and therefore not read by any process. BBBBRRRRKKKKIIIINNNNTTTT If IIIIGGGGNNNNBBBBRRRRKKKK is not set and BBBBRRRRKKKKIIIINNNNTTTT is set, the break condition will flush the input and output queues and if the terminal is the controlling terminal of a foreground process group, the break condition will generate a single SSSSIIIIGGGGIIIINNNNTTTT signal to that foreground process group. If neither IIIIGGGGNNNNBBBBRRRRKKKK nor BBBBRRRRKKKKIIIINNNNTTTT is set, a break condition is read as a single ASCII NNNNUUUULLLL PPPPaaaaggggeeee 8888 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) character, or if PPPPAAAARRRRMMMMRRRRKKKK is set, as: `0377', `0', `0'. IIIIGGGGNNNNPPPPAAAARRRR If IIIIGGGGNNNNPPPPAAAARRRR is set, a byte with framing or parity errors (other than break) is ignored. PPPPAAAARRRRMMMMRRRRKKKK If PPPPAAAARRRRMMMMRRRRKKKK is set, and IIIIGGGGNNNNPPPPAAAARRRR is not set, a character with a framing or parity error (other than break) is read as the three-character sequence: `0377', `0', `X', where X is the data of the character received in error. To avoid ambiguity in this case, if IIIISSSSTTTTRRRRIIIIPPPP is not set, a valid character of `0377' is read as `0377', `0377'. If neither PPPPAAAARRRRMMMMRRRRKKKK nor IIIIGGGGNNNNPPPPAAAARRRR is set, a framing or parity error (other than break) is read as the single ASCII NNNNUUUULLLL character. IIIINNNNPPPPCCCCKKKK If IIIINNNNPPPPCCCCKKKK is set, input parity checking is enabled. If IIIINNNNPPPPCCCCKKKK is not set, input parity checking is disabled. This allows output parity generation without input parity errors. IIIISSSSTTTTRRRRIIIIPPPP If IIIISSSSTTTTRRRRIIIIPPPP is set, valid input characters are first stripped to 7-bits, otherwise all 8-bits are processed. IIIINNNNLLLLCCCCRRRR If IIIINNNNLLLLCCCCRRRR is set, a received NNNNLLLL character is translated into a CCCCRRRR character. IIIIGGGGNNNNCCCCRRRR If IIIIGGGGNNNNCCCCRRRR is set, a received CCCCRRRR character is ignored (not read). IIIICCCCRRRRNNNNLLLL If IIIICCCCRRRRNNNNLLLL is set, a received CCCCRRRR character is translated into a NNNNLLLL character. IIIIUUUUCCCCLLLLCCCC If IIIIUUUUCCCCLLLLCCCC is set, a received upper-case alphabetic character is translated into the corresponding lower-case character. IIIIXXXXOOOONNNN If IIIIXXXXOOOONNNN is set, start/stop output control is enabled. A received SSSSTTTTOOOOPPPP character will suspend output and a received SSSSTTTTAAAARRRRTTTT character will restart output. The SSSSTTTTOOOOPPPP and SSSSTTTTAAAARRRRTTTT characters will not be read, but will mearly perform flow control functions. IIIIXXXXAAAANNNNYYYY If IIIIXXXXAAAANNNNYYYY is set, any input character will restart output that has been suspended. IIIIXXXXOOOOFFFFFFFF If IIIIXXXXOOOOFFFFFFFF is set, the system will transmit SSSSTTTTAAAARRRRTTTT////SSSSTTTTOOOOPPPP characters when the input queue is nearly empty/full. IIIIMMMMAAAAXXXXBBBBEEEELLLL If IIIIMMMMAAAAXXXXBBBBEEEELLLL is set, the ASCII BBBBEEEELLLL character is echoed if the input stream overflows. Further input is discarded, but any input already present in the input stream is preserved. OOOOuuuuttttppppuuuutttt MMMMooooddddeeeessss PPPPaaaaggggeeee 9999 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) The _c__o_f_l_a_g field specifies the system treatment of output. The values, functions, and symbolic names of the bits and subfields in the _c__o_f_l_a_g field are as follows: OPOST 0000001 Postprocess output. OLCUC 0000002 Map lower case to upper on output. ONLCR 0000004 Map NL to CR-NL on output. OCRNL 0000010 Map CR to NL on output. ONOCR 0000020 No CR output at column 0. ONLRET 0000040 NL performs CR function. OFILL 0000100 Use fill characters for delay. OFDEL 0000200 Fill is DEL, else NUL. NLDLY 0000400 Select new-line delays: NL0 0 NL1 0000400 CRDLY 0003000 Select carriage-return delays: CR0 0 CR1 0001000 CR2 0002000 CR3 0003000 TABDLY 0014000 Select horizontal-tab delays: TAB0 0 TAB1 0004000 TAB2 0010000 TAB3 0014000 Expand tabs to spaces. BSDLY 0020000 Select backspace delays: BS0 0 BS1 0020000 VTDLY 0040000 Select vertical-tab delays: VT0 0 VT1 0040000 FFDLY 0100000 Select form-feed delays: FF0 0 FF1 0100000 OOOOPPPPOOOOSSSSTTTT If OOOOPPPPOOOOSSSSTTTT is set, output characters are post-processed as indicated by the remaining flags, otherwise characters are transmitted without change. OOOOLLLLCCCCUUUUCCCC If OOOOLLLLCCCCUUUUCCCC is set, a lower-case alphabetic character is transmitted as the corresponding upper-case character. This function is often used in conjunction with IIIIUUUUCCCCLLLLCCCC.... OOOONNNNLLLLCCCCRRRR If OOOONNNNLLLLCCCCRRRR is set, the NNNNLLLL character is transmitted as the CCCCRRRR----NNNNLLLL character pair. OOOOCCCCRRRRNNNNLLLL If OOOOCCCCRRRRNNNNLLLL is set, the CCCCRRRR character is transmitted as the NNNNLLLL character. OOOONNNNOOOOCCCCRRRR If OOOONNNNOOOOCCCCRRRR is set, no CCCCRRRR character is transmitted when at column 0 (first position). PPPPaaaaggggeeee 11110000 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) OOOONNNNLLLLRRRREEEETTTT If OOOONNNNLLLLRRRREEEETTTT is set, the NNNNLLLL character is assumed to do the carriage-return function; the column pointer will be set to 0 and the delays specified for CCCCRRRR will be used. Otherwise the NNNNLLLL character is assumed to do just the line-feed function; the column pointer will remain unchanged. The column pointer is also set to 0 if the CCCCRRRR character is actually transmitted. OOOOFFFFIIIILLLLLLLL If OOOOFFFFIIIILLLLLLLL is set, fill characters will be transmitted for delay instead of a timed delay. This is useful for high baud rate terminals which need only a minimal delay. OOOOFFFFDDDDEEEELLLL If OOOOFFFFDDDDEEEELLLL is set, the fill character is DDDDEEEELLLL,,,, otherwise NNNNUUUULLLL.... The delay bits specify how long transmission stops to allow for mechanical or other movement when certain characters are sent to the terminal. In all cases a value of 0 indicates no delay. The actual delays depend on line speed and system load. NNNNLLLLDDDDLLLLYYYY Newline delay type 0 (NNNNLLLL0000) selects no delay. Newline delay type 1 (NNNNLLLL1111) lasts about 0.10 seconds. If OOOONNNNLLLLRRRREEEETTTT is set, the carriage-return delays are used instead of the new-line delays. If OOOOFFFFIIIILLLLLLLL is set, two fill characters will be transmitted. CCCCRRRRDDDDLLLLYYYY Carriage-return delay type 0 (CCCCRRRR0000) selects no delay. Carriage-return delay type 1 (CCCCRRRR1111) is dependent on the current column position, type 2 (CCCCRRRR2222) is about 0.10 seconds, and type 3 (CCCCRRRR3333) is about 0.15 seconds. If OOOOFFFFIIIILLLLLLLL is set, delay type 1 transmits two fill characters, and type 2, four fill characters. TTTTAAAABBBBDDDDLLLLYYYY Horizontal-tab delay type 0 (TTTTAAAABBBB0000) selects no delay. Horizontal-tab delay type 1 (TTTTAAAABBBB1111) is dependent on the current column position. Type 2 (TTTTAAAABBBB2222) is about 0.10 seconds. Type 3 (TTTTAAAABBBB3333) specifies that tabs are to be expanded into spaces. If OOOOFFFFIIIILLLLLLLL is set, two fill characters will be transmitted for any delay. BBBBSSSSDDDDLLLLYYYY Backspace delay type 0 (BBBBSSSS0000) selects no delay. Backspace delay type 1 (BBBBSSSS1111) lasts about 0.05 seconds. If OOOOFFFFIIIILLLLLLLL is set, one fill character will be transmitted. VVVVTTTTDDDDLLLLYYYY Vertical-tab delay type 0 (VVVVTTTT0000) selects no delay. Vertical- tab delay type 1 (VVVVTTTT1111) lasts about 2.0 seconds. FFFFFFFFDDDDLLLLYYYY Form-feed delay type 0 (FFFFFFFF0000) selects no delay. Form-feed delay type 0 (FFFFFFFF0000) lasts about 2.0 seconds. CCCCoooonnnnttttrrrroooollll MMMMooooddddeeeessss PPPPaaaaggggeeee 11111111 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) The _c__c_f_l_a_g field describes the hardware control of the terminal. The values, functions, and symbolic names of the bits and subfields in the _c__c_f_l_a_g field are as follows: CBAUD 000000017 No longer supported; see "Old termio" below. CSIZE 000000060 Character size: CS5 0 5 bits CS6 000000020 6 bits CS7 000000040 7 bits CS8 000000060 8 bits CSTOPB 000000100 Send two stop bits, else one. CREAD 000000200 Enable receiver. PARENB 000000400 Parity enable. PARODD 000001000 Odd parity, else even. HUPCL 000002000 Hang up on last close. CLOCAL 000004000 Local line, else dial-up. RCV1EN 000010000 Not supported. XMT1EN 000020000 Not supported. LOBLK 000040000 Block layer output. XCLUDE 000100000 Not supported. CIBAUD 003600000 Not supported. PAREXT 004000000 Not supported. CNEW_RTSCTS 010000000 Use RTS/CTS flow control CCCCSSSSIIIIZZZZEEEE The CCCCSSSSIIIIZZZZEEEE bits specify the character size in bits for both transmission and reception. This size does not include the parity bit, if any. CCCCSSSSTTTTOOOOPPPPBBBB If CCCCSSSSTTTTOOOOPPPPBBBB is set, two stop bits are used, otherwise one stop bit. For example, at 110 baud, two stops bits are required. CCCCRRRREEEEAAAADDDD If CCCCRRRREEEEAAAADDDD is set, the receiver is enabled. Otherwise no characters will be received. PPPPAAAARRRREEEENNNNBBBB If PPPPAAAARRRREEEENNNNBBBB is set, parity generation and detection is enabled and a parity bit is added to each character. PPPPAAAARRRROOOODDDDDDDD If parity is enabled, the PPPPAAAARRRROOOODDDDDDDD flag specifies odd parity if set, otherwise even parity is used. HHHHUUUUPPPPCCCCLLLL If HHHHUUUUPPPPCCCCLLLL is set, the line will be disconnected when the last process with the line open closes it or terminates. That is, the data-terminal-ready signal will not be asserted. CCCCLLLLOOOOCCCCAAAALLLL If CCCCLLLLOOOOCCCCAAAALLLL is set, the line is assumed to be a local, direct connection with no modem control. Otherwise modem control is assumed. PPPPaaaaggggeeee 11112222 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) LLLLOOOOBBBBLLLLKKKK If LLLLOOOOBBBBLLLLKKKK is set, the output of a job control layer will be blocked when it is not the current layer. Otherwise the output generated by that layer will be multiplexed onto the current layer. CCCCNNNNEEEEWWWW____RRRRTTTTSSSSCCCCTTTTSSSS If CCCCNNNNEEEEWWWW____RRRRTTTTSSSSCCCCTTTTSSSS is set, and the communications port supports it, RTS/CTS handshaking will be used. When the input queue becomes nearly full, RTS will be dropped. RTS will be reasserted when the input queue has drained sufficiently. Output is suspended when CTS is lowered and restarted when CTS is raised. This flag is automatically set on the ttttttttyyyyffff serial port devices; see _s_e_r_i_a_l(7). LLLLooooccccaaaallll MMMMooooddddeeeessss The _c__l_f_l_a_g field of the argument structure is used by the line discipline to control terminal functions. The following flags are currently defined: ISIG 0000001 Enable signals. ICANON 0000002 Canonical input (erase and kill processing). XCASE 0000004 Canonical upper/lower presentation. ECHO 0000010 Enable echo. ECHOE 0000020 Echo erase character as BS-SP-BS. ECHOK 0000040 Echo NL after kill character. ECHONL 0000100 Echo NL. NOFLSH 0000200 Disable flush after interrupt or quit. IEXTEN 0000400 Enable extended functions (not used by IRIX). ECHOCTL 0001000 Echo control characters as ^char, delete as ^?. ECHOPRT 0002000 Echo erase character as character erased. ECHOKE 0004000 BS-SP-BS entire line on line kill. FLUSHO 0020000 Output being flushed. PENDIN 0040000 Retype pending input at next read or input char. TOSTOP 0100000 Send SIGTTOU for background output. IIIISSSSIIIIGGGG If IIIISSSSIIIIGGGG is set, each input character is checked against the special control characters IIIINNNNTTTTRRRR,,,, SSSSUUUUSSSSPPPP,,,, DDDDSSSSUUUUSSSSPPPP,,,, and QQQQUUUUIIIITTTT.... If an input character matches one of these control characters, the function associated with that character is performed. If IIIISSSSIIIIGGGG is not set, no checking is done. Thus these special input functions are possible only if IIIISSSSIIIIGGGG is set. These functions may be disabled individually by changing the value of the control character to CCCCNNNNUUUULLLL or ____PPPPOOOOSSSSIIIIXXXX____VVVVDDDDIIIISSSSAAAABBBBLLLLEEEE IIIICCCCAAAANNNNOOOONNNN If IIIICCCCAAAANNNNOOOONNNN is set, canonical processing is enabled. This enables the erase and kill edit functions, and the assembly of input characters into lines delimited by NNNNLLLL, EEEEOOOOFFFF,,,, EEEEOOOOLLLLand EEEEOOOOLLLL2222. If IIIICCCCAAAANNNNOOOONNNN is not set, read requests are satisfied directly from the input queue. A read will not be satisfied until at least MMMMIIIINNNN characters have been received or the timeout value TTTTIIIIMMMMEEEE has expired between characters. This allows fast bursts of input to be read efficiently while PPPPaaaaggggeeee 11113333 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) still allowing single character input. The MMMMIIIINNNN and TTTTIIIIMMMMEEEE values are stored in the position for the EEEEOOOOFFFF and EEEEOOOOLLLL characters, respectively. The time value represents tenths of seconds. XXXXCCCCAAAASSSSEEEE If XXXXCCCCAAAASSSSEEEE is set, and if IIIICCCCAAAANNNNOOOONNNN is set, an upper-case letter is accepted on input by preceding it with a \\\\ character, and is output preceded by a \\\\ character. In this mode, the following escape sequences are generated on output and accepted on input: for: use: ` \' | \! ~ \^ { \( } \) \ \\ For example, ``A'' is input as ``\a'', ``\n'' as ``\\n'', and ``\N'' as ``\\\n''. EEEECCCCHHHHOOOO If EEEECCCCHHHHOOOO is set, characters are echoed as received. When IIIICCCCAAAANNNNOOOONNNN is set, the following echo functions are possible. EEEECCCCHHHHOOOOEEEE If EEEECCCCHHHHOOOO and EEEECCCCHHHHOOOOEEEE are set, and EEEECCCCHHHHOOOOPPPPRRRRTTTT is not set, the EEEERRRRAAAASSSSEEEE and WWWWEEEERRRRAAAASSSSEEEE characters are echoed as one or more ASCII BBBBSSSS SSSSPPPP BBBBSSSS,,,, which will clear the last character(s) from a CCCCRRRRTTTT screen. If EEEECCCCHHHHOOOOEEEE is set and EEEECCCCHHHHOOOO is not set, the erase character is echoed as ASCII SSSSPPPP BBBBSSSS.... EEEECCCCHHHHOOOOKKKK If EEEECCCCHHHHOOOOKKKK is set, and EEEECCCCHHHHOOOOKKKKEEEE is not set, the NNNNLLLL character will be echoed after the kill character to emphasize that the line will be deleted. Note that an escape character or an LLLLNNNNEEEEXXXXTTTT character preceding the erase or kill character removes any special function (see ``Special Characters'' above). EEEECCCCHHHHOOOONNNNLLLL If EEEECCCCHHHHOOOONNNNLLLL is set, the NNNNLLLL character will be echoed even if EEEECCCCHHHHOOOO is not set. This is useful for terminals set to local echo (so-called half duplex). Unless escaped, the EEEEOOOOFFFF character is not echoed. Because EEEEOOOOTTTT is the default EEEEOOOOFFFF character, this prevents terminals that respond to EEEEOOOOTTTT from hanging up. NNNNOOOOFFFFLLLLSSSSHHHH If NNNNOOOOFFFFLLLLSSSSHHHH is set, the normal flush of the input and output queues associated with the IIIINNNNTTTTRRRR, QQQQUUUUIIIITTTT, and SSSSUUUUSSSSPPPP characters will not be done. PPPPaaaaggggeeee 11114444 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTOOOOSSSSTTTTOOOOPPPP If TTTTOOOOSSSSTTTTOOOOPPPP is set, the signal SSSSIIIIGGGGTTTTTTTTOOOOUUUU is sent to a process that tries to write to its controlling terminal if it is not in the foreground process group for that terminal. This signal normally stops the process. Otherwise, the output generated by that process is output to the current output stream. Processes that are blocking or ignoring SSSSIIIIGGGGTTTTTTTTOOOOUUUU signals are excepted and allowed to produce output and the SSSSIIIIGGGGTTTTTTTTOOOOUUUU signal is not sent. EEEECCCCHHHHOOOOCCCCTTTTLLLL If EEEECCCCHHHHOOOOCCCCTTTTLLLL is set, all control characters (characters with codes between 0 and 37 octal) other than ASCII TTTTAAAABBBB, ASCII NNNNLLLL, the SSSSTTTTAAAARRRRTTTT character, the SSSSTTTTOOOOPPPP character, ASCII CCCCRRRR, and ASCII BBBBSSSS are echoed as ^X, where X is the character given by adding 100 octal to the code of the control character (so that the character with octal code 1 is echoed as ^A), and the ASCII DDDDEEEELLLL character, with code 177 octal is echoed as ^?. EEEECCCCHHHHOOOOPPPPRRRRTTTT If EEEECCCCHHHHOOOO and EEEECCCCHHHHOOOOPPPPRRRRTTTT are set, the first EEEERRRRAAAASSSSEEEE or WWWWEEEERRRRAAAASSSSEEEE character in a sequence echoes as a backslash (\), followed by the characters being erased. Subsequent EEEERRRRAAAASSSSEEEE or WWWWEEEERRRRAAAASSSSEEEE characters echo the characters being erased in reverse order. The next non-erase character causes a slash (/) to be typed before it is echoed. EEEECCCCHHHHOOOOKKKKEEEE If EEEECCCCHHHHOOOOKKKKEEEE is set, the kill character is echoed by erasing each character on the line from the screen (using the mechanism selected by EEEECCCCHHHHOOOOEEEE and EEEECCCCHHHHOOOOPPPPRRRRTTTT). FFFFLLLLUUUUSSSSHHHHOOOO If FFFFLLLLUUUUSSSSHHHHOOOO is set, data written to the terminal is discarded. This bit is set when the FFFFLLLLUUUUSSSSHHHH////DDDDIIIISSSSCCCCAAAARRRRDDDD character is typed. A program can cancel the effect of typing the FFFFLLLLUUUUSSSSHHHH////DDDDIIIISSSSCCCCAAAARRRRDDDD character by clearing FFFFLLLLUUUUSSSSHHHHOOOO. PPPPEEEENNNNDDDDIIIINNNN If PPPPEEEENNNNDDDDIIIINNNN is set, any input that has not yet been read is reprinted when the next character arrives as input. SSSSppppeeeeeeeedddd The _c__o_s_p_e_e_d and _c__i_s_p_e_e_d fields control the output and input speeds of the line, respectively, in bits per second (bps). No current SGI devices support setting output and input speeds to different values, however, so _c__i_s_p_e_e_d is not supported. B0 0 Hang up B50 50 50 bps B75 75 75 bps B110 110 110 bps B134 134 134 bps B150 150 150 bps B200 200 200 bps B300 300 300 bps B600 600 600 bps PPPPaaaaggggeeee 11115555 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) B1200 1200 1200 bps B1800 1800 1800 bps B2400 2400 2400 bps B4800 4800 4800 bps B9600 9600 9600 bps B19200 19200 19200 bps B38400 38400 38400 bps B57600 57600 57600 bps B76800 76800 76800 bps B115200 115200 115200 bps SSPEED B9600 Default baud rate. The B* names are provided only for convenience; applications may use plain integer values in _c__o_s_p_e_e_d and _c__i_s_p_e_e_d. Note that capabilities of serial ports vary; not all devices support all bit rates. Some devices support additional rates. TTTTeeeerrrrmmmmiiiioooo SSSSttttrrrruuuuccccttttuuuurrrreeee The System V tttteeeerrrrmmmmiiiioooo structure is used by some iiiiooooccccttttlllls; it is defined by <<<<ssssyyyyssss////tttteeeerrrrmmmmiiiioooo....hhhh>>>> and includes the following members: struct termio { tcflag_t c_iflag; /* input modes */ tcflag_t c_oflag; /* output modes */ tcflag_t c_cflag; /* control modes */ tcflag_t c_lflag; /* local modes */ speed_t c_ospeed; /* output speed */ speed_t c_ispeed; /* input speed; not supported */ char c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control chars */ }; The _c__l_i_n_e field defines the _l_i_n_e _d_i_s_c_i_p_l_i_n_e used to interpret control characters. A line discipline is associated with a family of interpretations. For example, LLLLDDDDIIIISSSSCCCC0000 is the standard System V set of interpretations, while LLLLDDDDIIIISSSSCCCC1111 is similar to the interpretations used in the 4.3BSD tty driver. In LLLLDDDDIIIISSSSCCCC1111,,,, +o additional control characters are available, +o control characters which are not editing characters are echoed as '^' followed by the equivalent letter, +o backspacing does not back up into the prompt, +o input is re-typed when backspacing encounters a confusion between what the user and the computer have typed, and PPPPaaaaggggeeee 11116666 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) +o job control is available. The symbolic name NNNNCCCCCCCCSSSS is the size of the control-character array and is also defined by <<<<tttteeeerrrrmmmmiiiioooo....hhhh>>>>. The relative positions, subscript names, and typical default values for each function are as follows: 0 VINTR CINTR (DEL) 1 VQUIT CQUIT (Control-\) 2 VERASE CERASE (Control-H (backspace)) 3 VKILL CKILL (Control-U) 4 VEOF CEOF (Control-D (EOT)) 4 VMIN 5 VEOL NUL 5 VTIME 6 VEOL2 NUL If the line discipline (_c__l_i_n_e) is set to LLLLDDDDIIIISSSSCCCC1111,,,, then additional control characters are defined: 7 VSWTCH CNSWTCH (NUL) 8 VSTART CSTART (Control-Q) 9 VSTOP CSTOP (Control-S) 10 VSUSP CNSWTCH (NUL) 11 VDSUSP CNUL (NUL) 12 VREPRINT CRPRNT (Control-R) 13 VFLUSH CFLUSH (Control-O) 14 VWERASE CWERASE (Control-W) 15 VLNEXT CLNEXT (Control-V) OOOOlllldddd tttteeeerrrrmmmmiiiioooo aaaannnndddd tttteeeerrrrmmmmiiiioooossss For compatibility with existing binaries, MIPS ABI programs, and programs that cannot be ported to use the new tttteeeerrrrmmmmiiiioooo or tttteeeerrrrmmmmiiiioooossss structures, the old interfaces are retained. Existing binaries automatically use the old interfaces. By defining ____OOOOLLLLDDDD____TTTTEEEERRRRMMMMIIIIOOOOSSSS at compile time (before including <<<<tttteeeerrrrmmmmiiiioooossss....hhhh>>>>, <<<<tttteeeerrrrmmmmiiiioooo....hhhh>>>>, or <<<<ssssyyyyssss////ttttttttyyyyddddeeeevvvv....hhhh>>>>), the old interfaces are in effect. The old tttteeeerrrrmmmmiiiioooossss structure is defined as follows: struct termios { tcflag_t c_iflag; /* input modes */ tcflag_t c_oflag; /* output modes */ tcflag_t c_cflag; /* control modes */ tcflag_t c_lflag; /* local modes */ cc_t c_cc[NCCS]; /* control chars */ }; and the old tttteeeerrrrmmmmiiiioooo structure is defined as follows: struct termio { tcflag_t c_iflag; /* input modes */ tcflag_t c_oflag; /* output modes */ tcflag_t c_cflag; /* control modes */ PPPPaaaaggggeeee 11117777 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) tcflag_t c_lflag; /* local modes */ char c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control chars */ }; The members are as described above, except for _c__c_f_l_a_g, in which CCCCBBBBAAAAUUUUDDDD encodes the bit rate: CBAUD 000000017 Baud rate: B0 0 Hang up B50 000000001 50 baud B75 000000002 75 baud B110 000000003 110 baud B134 000000004 134 baud B150 000000005 150 baud B200 000000006 200 baud B300 000000007 300 baud B600 000000010 600 baud B1200 000000011 1200 baud B1800 000000012 1800 baud B2400 000000013 2400 baud B4800 000000014 4800 baud B9600 000000015 9600 baud B19200 000000016 19200 baud EXTA 000000016 External A B38400 000000017 38400 baud EXTB 000000017 External B SSPEED B9600 Default baud rate. MMMMiiiixxxxiiiinnnngggg oooolllldddd aaaannnndddd nnnneeeewwww iiiinnnntttteeeerrrrffffaaaacccceeeessss If a bit rate is set using the new tttteeeerrrrmmmmiiiioooo or tttteeeerrrrmmmmiiiioooossss interfaces (or the POSIX interfaces described in termios(3)) that cannot be represented in the old CCCCBBBBAAAAUUUUDDDD field, then the old tttteeeerrrrmmmmiiiioooo, tttteeeerrrrmmmmiiiioooossss, and POSIX interfaces will return ____IIIINNNNVVVVAAAALLLLIIIIDDDD____BBBBAAAAUUUUDDDD in the CCCCBBBBAAAAUUUUDDDD field. If the bit rate is set to ____IIIINNNNVVVVAAAALLLLIIIIDDDD____BBBBAAAAUUUUDDDD using the old interfaces, the bit rate change will be ignored, and the actual line speed will remain unchanged. This allows many programs that do not explicitly manage bit rates to work with the new interfaces without change. And, it allows some old programs to work with new, fast bit rates without change. For example, sequences similar to the following (which are very common) work with either old or new interfaces, even if the line is currently set to a baud rate than cannot be represented in the old CCCCBBBBAAAAUUUUDDDD field: struct termio t; ioctl(fd, TCGETA, &t); t.c_cflag |= CREAD; t.c_lflag &= ~ECHO; /* t.c_cflag & CBAUD may contain _INVALID_BAUD, but, if so, */ /* this TCSETA will not affect the actual bit rate */ ioctl(fd, TCSETA, &t); PPPPaaaaggggeeee 11118888 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) SSSSyyyysssstttteeeemmmm CCCCaaaallllllllssss The _i_o_c_t_l()s supported by devices and SSSSTTTTRRRREEEEAAAAMMMMSSSS modules providing the tttteeeerrrrmmmmiiiioooo and tttteeeerrrrmmmmiiiioooossss interface are listed below. TTTTCCCCGGGGEEEETTTTAAAA The argument is a pointer to a tttteeeerrrrmmmmiiiioooo structure. Get the parameters associated with the terminal and store in the tttteeeerrrrmmmmiiiioooo structure referenced by aaaarrrrgggg. TTTTCCCCSSSSEEEETTTTAAAA The argument is a pointer to a tttteeeerrrrmmmmiiiioooo structure. Set the parameters associated with the terminal from the structure referenced by aaaarrrrgggg. The change is immediate. TTTTCCCCSSSSEEEETTTTAAAAWWWW The argument is a pointer to a tttteeeerrrrmmmmiiiioooo structure. Wait for the output to drain before setting the new parameters. This form should be used when changing parameters that will affect output. TTTTCCCCSSSSEEEETTTTAAAAFFFF The argument is a pointer to a tttteeeerrrrmmmmiiiioooo structure. Wait for the output to drain, then flush the input queue and set the new parameters. TTTTCCCCGGGGEEEETTTTSSSS The argument is a pointer to a tttteeeerrrrmmmmiiiioooossss structure. Get the parameters associated with the terminal and store in the tttteeeerrrrmmmmiiiioooossss structure referenced by aaaarrrrgggg. See _t_c_g_e_t_a_t_t_r(3). TTTTCCCCSSSSEEEETTTTSSSS The argument is a pointer to a tttteeeerrrrmmmmiiiioooossss structure. Set the parameters associated with the terminal from the structure referenced by aaaarrrrgggg. The change is immediate. See _t_c_s_e_t_a_t_t_r(3). TTTTCCCCSSSSEEEETTTTSSSSWWWW The argument is a pointer to a tttteeeerrrrmmmmiiiioooossss structure. Wait for the output to drain before setting the new parameters. This form should be used when changing parameters that will affect output. See _t_c_s_e_t_a_t_t_r(3). TTTTCCCCSSSSEEEETTTTSSSSFFFF The argument is a pointer to a tttteeeerrrrmmmmiiiioooossss structure. Wait for the output to drain, then flush the input queue and set the new parameters. See _t_c_s_e_t_a_t_t_r(3). TTTTCCCCSSSSBBBBRRRRKKKK The argument is an iiiinnnntttt value. Wait for the output to drain. If _a_r_g is 0, then send a break (zero bits for 0.25 seconds). See _t_c_s_e_n_d_b_r_e_a_k(3) and _t_c_d_r_a_i_n(3). TTTTCCCCXXXXOOOONNNNCCCC Start/stop control. The argument is an iiiinnnntttt value. If _a_r_g is 0, suspend output; if 1, restart suspended output; if 2, suspend input; if 3, restart suspended input. See _t_c_f_l_o_w(3). TTTTCCCCFFFFLLLLSSSSHHHH The argument is an iiiinnnntttt value. If _a_r_g is 0, flush the input queue; if 1, flush the output queue; if 2, flush both the input and output queues. See _t_c_f_l_u_s_h(3). PPPPaaaaggggeeee 11119999 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTIIIIOOOOCCCCNNNNOOOOTTTTTTTTYYYY Disconnect calling process from terminal and session. TTTTIIIIOOOOCCCCSSSSTTTTIIII Simulate terminal input: _a_r_g points to a character which the system pretends has been typed on the terminal. TTTTIIIIOOOOCCCCSSSSPPPPGGGGRRRRPPPP Set process group of tty: _a_r_g is a pointer to a ppppiiiidddd____tttt which is the value to which the process group ID for this terminal will be set. See _t_c_s_e_t_p_g_r_p(_3). TTTTIIIIOOOOCCCCGGGGPPPPGGGGRRRRPPPP Get process group of tty: _a_r_g is a pointer to a ppppiiiidddd____tttt into which is placed the process group ID of the process group for which this terminal is the controlling terminal. See _t_c_g_e_t_p_g_r_p(_3). TTTTIIIIOOOOCCCCGGGGSSSSIIIIDDDD _a_r_g is a pointer to a ppppiiiidddd____tttt into which is placed the session ID of the terminal. TTTTIIIIOOOOCCCCFFFFLLLLUUUUSSSSHHHH If the iiiinnnntttt pointed to by _a_r_g has a zero value, all characters waiting in input or output queues are flushed. Otherwise, the value of the iiiinnnntttt is for the FREAD and FWRITE bits defined in <_s_y_s/_f_i_l_e._h>; if the FREAD bit is set, all characters waiting in input queues are flushed, and if the FWRITE bit is set, all characters waiting in output queues are flushed. TTTTIIIIOOOOCCCCMMMMGGGGEEEETTTT The argument is a pointer to an iiiinnnntttt sized bit field into which the current state of the modem status lines is stored. This _i_o_c_t_l() is supported only on special files representing serial ports. See _s_e_r_i_a_l(7). The symbolic names of the bits returned in _a_r_g are defined by <_s_y_s/_t_e_r_m_i_o_s._h>: TIOCM_LE line enable TIOCM_DTR data terminal ready TIOCM_RTS request to send TIOCM_ST secondary transmit TIOCM_SR secondary receive TIOCM_CTS clear to send TIOCM_CAR carrier detect TIOCM_CD synonym for TIOCM_CAR TIOCM_RNG ring TIOCM_RI synonym for TIOCM_RNG TIOCM_DSR data set ready Not all of these are necessarily supported by any particular device. TTTTIIIIOOOOCCCCMMMMSSSSEEEETTTT The argument is a pointer to an iiiinnnntttt sized bit field used to set the state of the modem status lines. If a bit is set, the coresponding modem status line is turned on. If a bit is cleared the coresponding modem status line is turned off. This _i_o_c_t_l() is supported only on special files representing PPPPaaaaggggeeee 22220000 TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) TTTTEEEERRRRMMMMIIIIOOOO((((7777)))) serial ports. See _s_e_r_i_a_l(7). The symbolic names of the bits used in _a_r_g are the same as for TTTTIIIIOOOOCCCCMMMMGGGGEEEETTTT.... Only DTR and RTS are settable with this _i_o_c_t_l(). Not all of these are necessarily supported by any particular device. TTTTIIIIOOOOCCCCGGGGWWWWIIIINNNNSSSSZZZZ Get window size: _a_r_g is a pointer to a structure of the following form: Window size structure: struct winsize { unsigned short ws_row; /* rows, in chars */ unsigned short ws_col; /* columns, in chars */ unsigned short ws_xpixel; /* horiz. pixels */ unsigned short ws_ypixel; /* vert. pixels */ }; TTTTIIIIOOOOCCCCSSSSWWWWIIIINNNNSSSSZZZZ Set window size: _a_r_g is a pointer to a structure of a _w_i_n_s_i_z_e structure. FFFFIIIIOOOONNNNRRRREEEEAAAADDDD Return the number of bytes currently available to read. _a_r_g is a pointer to an _i_n_t. FFFFIIIIOOOONNNNBBBBIIIIOOOO Enables or disables non-blocking mode, according to the boolean value of the contents of _a_r_g. _a_r_g is a pointer to an _i_n_t. Enabling this mode has the same effect as the OOOO____NNNNDDDDEEEELLLLAAAAYYYY flag for _o_p_e_n(2). The following _i_o_c_t_l calls apply only to pseudo terminals; see _p_t_y(7M) for their descriptions: TTTTIIIIOOOOCCCCPPPPKKKKTTTT, TTTTIIIIOOOOCCCCPPPPKKKKTTTT____DDDDAAAATTTTAAAA, TTTTIIIIOOOOCCCCPPPPKKKKTTTT____FFFFLLLLUUUUSSSSHHHHRRRREEEEAAAADDDD, TTTTIIIIOOOOCCCCPPPPKKKKTTTT____FFFFLLLLUUUUSSSSHHHHWWWWRRRRIIIITTTTEEEE, TTTTIIIIOOOOCCCCPPPPKKKKTTTT____SSSSTTTTOOOOPPPP, TTTTIIIIOOOOCCCCPPPPKKKKTTTT____SSSSTTTTAAAARRRRTTTT, TTTTIIIIOOOOCCCCPPPPKKKKTTTT____NNNNOOOOSSSSTTTTOOOOPPPP and TTTTIIIIOOOOCCCCPPPPKKKKTTTT____DDDDOOOOSSSSTTTTOOOOPPPP. NNNNOOOOTTTTEEEESSSS Of the _i_o_c_t_l commands listed above, all except TTTTCCCCGGGGEEEETTTTAAAA and TTTTCCCCGGGGEEEETTTTSSSS alter the state of the terminal. For this reason, a background job which issues any of commands except TTTTCCCCGGGGEEEETTTTAAAA or TTTTCCCCGGGGEEEETTTTSSSS will be suspended. Refer to _c_s_h(1) or _k_s_h(1) for more information about job control. FFFFIIIILLLLEEEESSSS /dev/tty* SSSSEEEEEEEE AAAALLLLSSSSOOOO stty(1), fork(2), ioctl(2), setsid(2), setpgrp(2), signal(2), tcdrain(3), tcflow(3), tcflush(3), tcgetattr(3), tcgetpgrp(3), tcsendbreak(3), tcsetattr(3), tcsetpgrp(3), pty(7M), serial(7), termios(3) PPPPaaaaggggeeee 22221111